/**raise*/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<unistd.h>
#include<signal.h>

static void sig_handler(int sig)
{
	printf("received signal:%d\n",sig);
}
int main(void)
{
	struct sigaction sig={0};
	int ret;
	sig.sa_handler=sig_handler;
	sig.sa_flags=0;
	ret=sigaction(SIGINT,&sig,NULL);
	if(-1==ret){
		perror("sigaction error");
		exit(-1);
	}
	for(;;){
		if(0!=raise(SIGINT)){
			puts("raise error");
			return 1;
		}
		sleep(3);
	}
	return 0;
}
